package com.yxy.mapper;

import com.github.pagehelper.Page;
import com.yxy.pojo.dto.PageQueryDTO;
import com.yxy.pojo.entity.Book;
import com.yxy.pojo.vo.BookDetailVO;
import com.yxy.pojo.vo.BookPageQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface BookMapper {

    /**
     * 分页查询图书
     */
    Page<BookPageQueryVO> queryByPage(PageQueryDTO pageQueryDTO);

    /**
     * 新增图书
     */
    void addBook(Book book);

    /**
     * 根据id查询图书详情
     * @param id
     * @return
     */
    @Select("select * from book where id = #{id}")
    BookDetailVO selectById(int id);

    /**
     * 更新图书
     * @param book
     */
    void updateBook(Book book);

    /**
     * 根据标题查询图书
     * @param title
     * @return
     */
    @Select("select * from book where title = #{title}")
    Book selectByTitle(String title);
}
